﻿using CommunityToolkit.Mvvm.ComponentModel;

namespace MG.SmartHMI.Model.VO
{
    /// <summary>
    /// <see cref="Entity.DAO.ModbusInfo"/>
    /// </summary>
    public partial class ModbusInfVO : ObservableRecipient
    {
        public int Id { get; set; }

        public int ConnectTimeOut { get; set; } = 1000;

        [ObservableProperty]
        private int timeInterVal;

        [ObservableProperty]
        private bool enableRtu;

        [ObservableProperty]
        private int dataFormat;

        [ObservableProperty]
        private string station;

        [ObservableProperty]
        private bool firstStrFrom0;

        [ObservableProperty]
        private bool strResever;

        #region serial port inf

        [ObservableProperty]
        private string portName;

        [ObservableProperty]
        private int baudRate;

        public int DataBits { get => DataBitsIndex + 5; set => DataBitsIndex = value - 5; }

        [ObservableProperty]
        private int dataBitsIndex;

        [ObservableProperty]
        private int stopBits;

        [ObservableProperty]
        private int parity;

        #endregion serial port inf

        #region tcp inf

        [ObservableProperty]
        private string iP;

        [ObservableProperty]
        private int port;

        #endregion tcp inf

        public DateTime CreateTime { get; set; }
    }
}